﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using STLGROUP.Layers.Presentations.FormBase;
using STLGROUP.Layers.Common;
using STLGROUP.Layers.DataAccessLayers;

namespace QuanLyBanHang
{
    /// <summary>
    /// In ma vach san pham
    /// </summary>
    /// <author>viet sang</author>
    /// <date>16/06/2012</date>
    public partial class PF002 : frmBase
    {
        private DT_SanPham _sanPham;
        private QuanLyBanHangEntities _context;
        private string PathSaveBarcode = string.Empty;

        public PF002()
        {
            InitializeComponent();
            this.Load += new EventHandler(PF002_Load);
            PathSaveBarcode = Application.StartupPath + @"\Barcode\" + stlBarCodeCtrl1.BarCode+".jpg";
            
        }

        private void PF002_Load(object sender, EventArgs e)
        {
            stlBarCodeCtrl1.BarCode = SanPham.MaSanPham;
            stlBarCodeCtrl1.HeaderText = SanPham.TenSanPham;     
        }

        public DT_SanPham SanPham
        {
            get { return _sanPham; }
            set { _sanPham = value; }
        }

        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            //stlBarCodeCtrl1.SaveImage(PathSaveBarcode);
            //SanPham.Barcode = UICommon.ImageToByteArray((Image.FromFile(PathSaveBarcode)));            
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        public QuanLyBanHangEntities Context
        {
            get { return _context; }
            set { _context = value; }
        }
    }
}
